﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using BUS;
namespace DoAn
{
    public partial class frTimKhachHang : Form
    {
        public frTimKhachHang()
        {
            InitializeComponent();
        }

        private void btnTim_Click(object sender, EventArgs e)
        {
            if (txtTenKH.Text == "")
                MessageBox.Show("Nhập tên khách hàng");
            KhachHangDTO khDTO = new KhachHangDTO();
            khDTO.TenKH = txtTenKH.Text.Trim();
            KhachHangBUS khBUS = new KhachHangBUS();
            List<KhachHangDTO> ds = khBUS.LayKhachHangTheoTen(khDTO.TenKH);
            if (ds.Count() > 0)
            {
                gridViewthongtinkh.Rows.Clear();
                for (int i = 0; i < ds.Count(); i++)
                {
                    gridViewthongtinkh.Rows.Add(ds[i].MaKH, ds[i].TenKH, ds[i].TenCongTy, ds[i].MaSoThue, ds[i].DiaChi, ds[i].DienThoai, ds[i].Fax, ds[i].Email);
                }
            }
            else
            {
                MessageBox.Show("Bạn cần chắc chắn mình nhập đúng khách hàng !!!");
            }
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
    
}
